const person = {
  name: '嘉文四世',
  age: 21
};
const result = new Proxy(person, {
  // 需要一个返回值
  get(target, property) {
    console.log(target, property);
    return property in target ? target[property] : undefined;
  },
  // 不需要返回值
  set(target, property, value) {
    console.log(target)
    if (!Number.isInteger(value)) {
      throw Error('type not');
    }
    target[property] = value;
  }
});

// result.cc = 1;
console.log(result.name, 'name');
console.log(result.name)
